// Learn TypeScript:
//  - https://docs.cocos.com/creator/manual/en/scripting/typescript.html
// Learn Attribute:
//  - https://docs.cocos.com/creator/manual/en/scripting/reference/attributes.html
// Learn life-cycle callbacks:
//  - https://docs.cocos.com/creator/manual/en/scripting/life-cycle-callbacks.html

const {ccclass, property} = cc._decorator;

@ccclass
export default class NewClass extends cc.Component {

    // LIFE-CYCLE CALLBACKS:

    onLoad () {
        this.node.on('mousedown', this.clickHandler)
    }

    start () {

    }

    // update (dt) {}

    clickHandler = () => {
        const h: number = 400;
        const peiqinode: cc.Node = cc.find('Canvas/peiqi')
        if(peiqinode){
            cc.tween(peiqinode)
                .by(0.5, {position: cc.v3(0, -h, 0)}, {easing: 'quadIn'})
                .by(0.2, {position: cc.v3(0, h / 6, 0)}, {easing: 'quadOut'})
                .by(0.2, {position: cc.v3(0, -(h / 6), 0)}, {easing: 'quadIn'})
                .start()
        }
    }
}
